package constraints;

/**
 * Indicates a piece of data failed to meet some constraint.
 * @author Jonathan Caddey
 */
public class ConstraintException extends RuntimeException {

	private static final long serialVersionUID = 7855545528361203343L;
	private final Type my_type = null;

	
	/**
	 * Used to specify the cause of the exception.
	 * @author Jonathan Caddey
	 */
	public static enum Type {
		VALUE_BELOW_MINIMUM, VALUE_ABOVE_MAXIMUM;
	}
	
	public ConstraintException(final Type the_type) {
		super(the_type.toString());
	}
	
	public ConstraintException(final String the_msg) {
		super(the_msg);
	}
	
	public ConstraintException() {
		super();
	}
	
	/**
	 * @return the cause of the exception.  May return null.
	 */
	// TEST COMPLETE? TODO
	// DOC COMPLETE? TODO
	public Type getType() {
		return my_type;
	}

}